package com.theydream.ichingwisdom.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

import com.theydream.ichingwisdom.R;
import com.theydream.ichingwisdom.tab.TabHostProvider;
import com.theydream.ichingwisdom.tab.TabView;
import com.theydream.ichingwisdom.tab.TabbarView;

public class Cards extends Activity {
	private TabHostProvider tabProvider;
	private TabView tabView;
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		tabProvider = new TabbarView(this);
		tabView = tabProvider.getTabHost("main");
		tabView.setCurrentView(R.layout.cards);
		View view=tabView.render(3);
		//TextView mallName=(TextView) view.findViewById(R.id.txtTitle);
		//mallName.setText(GlobalData.getInstance().getMall_name());
	
		
		 GridView gridview = (GridView) view.findViewById(R.id.gridview);
		    gridview.setAdapter(new ImageAdapter(this));

		    gridview.setOnItemClickListener(new OnItemClickListener() {
		        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
		            GlobalData.setShowCard(position);
		        	Intent intent=new Intent(Cards.this,CardDetail.class);
		            startActivity(intent);
		        	//Toast.makeText(Cards.this, "" + position, Toast.LENGTH_SHORT).show();
		        }
		    });
		   setContentView(view);
		//TextView btnAboutUs=(TextView) findViewById(R.id.AboutUs);

//		btnAboutUs.setOnClickListener(new OnClickListener() {
//			public void onClick(View v) {
//				startActivity(new Intent(Author.this,AboutUs.class));
//			}
//		});
//		btnTerms.setOnClickListener(new OnClickListener() {
//			public void onClick(View v) {
//				startActivity(new Intent(Author.this,TermAndCond.class));
//			}
//		});
		
	}
	
			
	

	public void onResume()
	{
		super.onResume();
//		FlurryAgent.logEvent("0.Author");
	}

}
